if(!window.Berta) window.Berta = {};

Berta.Storage = function() {
	
	this.save = function(key, objToSave) {
		//console.debug(JSON.stringify(objToSave));
		
		sessionStorage.setItem(key, JSON.stringify(objToSave));
	}
	
	this.load = function(key) {
		var value = sessionStorage.getItem(key);
		//$.log(key, value);
		if (value === null) {
			return null;
		} else {
			return JSON.parse(value); //jQuery.parseJSON(value);
		}
	}
	
	this.remove = function(key) {
		sessionStorage.removeItem(key);
	}
	
};

// Singleton
Berta.Storage._instance = null;
Berta.Storage.instance = function(options) {
	if(!Berta.Storage._instance) {
		Berta.Storage._instance = new Berta.Storage(options);
	}
	
	return Berta.Storage._instance;
}